﻿<Window x:Class="Mql2Fdk.Converter.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:Mql2Fdk.Converter.Controls" 
        Title="Advisor converter"
        Icon="/Mql2Fdk.CommonViews;component/Icons/Medium/document-new.png"
        Height="350" Width="525"
        Closing="OnClosingMainWindow"
        >

    <Window.CommandBindings>
        <CommandBinding Command="New" Executed="OnFileNew"  />
        <CommandBinding Command="Open" Executed="OnFileOpen" />
        <CommandBinding Command="Save" Executed="OnFileSave" />
        <CommandBinding Command="SaveAs" Executed="OnFileSaveAs" />
        <CommandBinding Command="Close" Executed="OnClose" />
    </Window.CommandBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Menu IsMainMenu="True">
            <MenuItem Header="File">
                <MenuItem Header="_New" Command="New">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-new.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="_Open"
                          Command="Open">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-open.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="_Save"
                          Command="Save">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-save.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Save _As"
                          Command="SaveAs">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-save.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Save _Mql"
                          Click="OnFileSaveMql">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-save.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Save as M_ql"
                          Click="OnFileSaveAsMql">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/document-save.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="_Encoding">
                    <MenuItem Header="Default"
                              Click="OnDefaultEncoding" />

                    <Separator />
                    <MenuItem Header="Utf8"
                              Click="OnUtf8Encoding" />
                    <MenuItem Header="Unicode"
                              Click="OnUnicodeEncoding" />
                    <MenuItem Header="Utf32"
                              Click="OnUtf32Encoding" />
                    <Separator />
                    <MenuItem Header="AutoDetect"
                              Click="OnAutoDetectEncoding" />

                </MenuItem>
                <Separator />
                <MenuItem Header="_Preferences"
                          Click="OnPreferences">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/preferences-system.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="_Close"
                          Command="Close">
                    <MenuItem.Icon>
                        <Image Width="20" Height="20" Source="/Mql2Fdk.CommonViews;component/Icons/Medium/system-log-out.png" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <TabControl Grid.Row="1" SelectionChanged="OnTabChange">
            <TabItem Header="Original Mq4">
                <Controls:CodeEditorControl x:Name="EditorControl" />
            </TabItem>
            <TabItem Header="C# Code">
                <Controls:OutputEditor x:Name="OutputEditor" />
            </TabItem>
        </TabControl>

        <Expander Header="Errors and warnings" Grid.Row="2" IsExpanded="True">
            <TextBox IsReadOnly="True" Height="64" x:Name="ErrorList" />
        </Expander>
    </Grid>
</Window>